@(spurnSvor: List[models.domain.QuestionAndAnswers], heiti: String, nafnNemanda: String, athugasemdNemanda : String,
vidhengiNemenda : List[models.data.Vidhengitaflanemendur])

@teacherMain(title = "Verkefni") {
    <div class="container">
        <div class="span9">
            <h3>@{heiti}</h3>
            <h4 class="borderBottomGrey">Nemandi : @{nafnNemanda}</h4>

            @if(spurnSvor == null){
                <p>Engar spurningar eru skráðar í þetta verkefni.</p>
            }
            @if(spurnSvor != null){
                @for((spurn,i) <- spurnSvor.zipWithIndex){
                    <h5>Spurning @(i+1) - @{spurn.getVaegi}%</h5>
                    <div class="well">
                        @if(spurn.getTegund == "texti"){
                            <p> @{spurn.getTexti}</p>
                            @if(spurn.getSpurningarsvar != null){
                                <p><input class ="input-xxlarge" value ="@{spurn.getSpurningarsvar}"disabled='disabled'> </p>
                            }else{
                                <p><input class ="input-xxlarge" disabled></p>
                            }
                        }
                        @if(spurn.getTegund == "eydufylling"){
                            <p>@{spurn.getTexti}<p>
                                @for((eydufylling,i) <- spurn.getEydufyllingar.zipWithIndex){
                                    @{eydufylling}
                                    @if(i != spurn.getEydufyllingar.size()-1){
                                        @if(spurn.getEydufyllingSvor != null){
                                            <input class="input-large" value="@{spurn.getEydufyllingSvor.get(i)}" disabled='disabled'>
                                        }else{
                                            <input class="input-large" disabled='disabled'>
                                        }
                                    }
                                }
                        }
                        @if(spurn.getTegund == "mynd"){
                            <p>@{spurn.getTexti}</p>
                            <figure><img src="data:image/png;base64,@{spurn.getVidhengi}"></figure>
                            @if(spurn.getSpurningarsvar != null){
                                <textarea class="input-xxlarge" disabled='disabled'>@{spurn.getSpurningarsvar}</textarea>
                            }else{
                                <textarea class="input-xxlarge" disabled='disabled'> </textarea>
                            }
                        }
                        @if(spurn.getTegund =="krossar"){
                            <p>@{spurn.getTexti}</p>
                            @for((krossasvor,j) <- spurn.getSvor.zipWithIndex){
                                @if(spurn.getSvorID.get(j) == spurn.getRettSvar && spurn.getKrossaSvarNemanda == spurn.getSvorID.get(j)){
                                    <p class="boldLine"><input type="radio" disabled='disabled' checked> @{krossasvor}</p>
                                }
                                @if(spurn.getSvorID.get(j) == spurn.getRettSvar && spurn.getKrossaSvarNemanda != spurn.getSvorID.get(j)){
                                    <p class="boldLine"><input type="radio" disabled='disabled'> @{krossasvor}</p>
                                }
                                @if(spurn.getSvorID.get(j) != spurn.getRettSvar && spurn.getKrossaSvarNemanda == spurn.getSvorID.get(j)){
                                    <p><input type="radio" disabled='disabled' checked> @{krossasvor}</p>
                                }
                                @if(spurn.getSvorID.get(j) != spurn.getRettSvar && spurn.getKrossaSvarNemanda != spurn.getSvorID.get(j)){
                                    <p><input type="radio" disabled='disabled'> @{krossasvor}</p>
                                }
                            }
                        }
                        @if(spurn.getTegund == "fjolval"){
                            <p>@{spurn.getTexti}</p>
                            @for((fjolvalsvor,j) <- spurn.getSvor.zipWithIndex){
                                @if(spurn.getFjolvalSvarNemenda != null){
                                    @if(spurn.getRettSvor.get(j) == 1 && spurn.getFjolvalSvarNemenda.get(j) == 1) {
                                        <p class="boldLine"><input type="checkbox" disabled='disabled' checked> @{fjolvalsvor}</p>
                                    }
                                    @if(spurn.getRettSvor.get(j) == 1 && spurn.getFjolvalSvarNemenda.get(j) == 0){
                                        <p class="boldLine"><input type="checkbox" disabled='disabled'> @{fjolvalsvor}</p>
                                    }
                                    @if(spurn.getRettSvor.get(j) == 0 && spurn.getFjolvalSvarNemenda.get(j) == 1){
                                        <p><input type="checkbox" disabled='disabled' checked> @{fjolvalsvor}</p>
                                    }
                                    @if(spurn.getRettSvor.get(j) == 0 && spurn.getFjolvalSvarNemenda.get(j) == 0){
                                        <p><input type="checkbox" disabled='disabled'> @{fjolvalsvor}</p>
                                    }
                                }else{
                                    @if(spurn.getRettSvor.get(j) == 1){
                                        <p class="boldLine"><input type="checkbox" disabled='disabled'> @{fjolvalsvor}</p>
                                    }else{
                                        <p><input type="checkbox" disabled='disabled'> @{fjolvalsvor}</p>
                                    }
                                }
                            }
                        }
                    </div>
                }
            }
            @if(vidhengiNemenda != null){
                <h4>Viðhengi frá nemenda</h4>
                <table class="table table-striped">
                    @for(vid <- vidhengiNemenda){
                        <tr>
                            @helper.form(action = routes.CommonController.downloadStudents(vid.getVerkefnaskil_id, vid.getNafn),'enctype -> "multipart/form-data", 'class -> "form-horizontal"){
                                <form method ="get" action="@{vid.getNafn}">
                                    <td><button type="submit" class="btn btn-primary btn-mini">
                                        <i class ="icon-download-alt"></i>
                                    </button>
                                        @{vid.getNafn} </td>
                                </form>
                            }
                            @if(vid.getContenttype=="application/pdf"){
                                @helper.form(action= routes.CommonController.openPdfInBrowserStudent(vid.getVerkefnaskil_id,vid.getNafn),'enctype -> "multipart/form-data", 'class -> "form-horizontal"){
                                    <td> <button type="submit" title="Opna skjalið í vafra" class="btn btn-primary btn-small">
                                        <i class="icon-globe"></i>  Opna í vafra
                                    </button></td>
                                }
                            }else{
                                <td> &nbsp;</td
                            }
                        </tr>
                    }
                </table>
            }
        </div>
    </div>
}